<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>5-字符类</title>
</head>
<body>
    <script>
        //[]  里面的字符，只要包含某一个都算正确
        //在字符串中只要有a或者b或者c都算正确
        var reg = /[abc]/;
        console.log(reg.test('baidu'));
        console.log(reg.test('sina'));
        console.log(reg.test('ali'));
        console.log(reg.test('xxx'));

        console.log('---------@2------------');
        //只匹配一个字符
        var reg2 = /^[abc]$/;
        console.log(reg2.test('a'));//true
        console.log(reg2.test('aa'));//false
        console.log(reg2.test('c'));//true

    </script>
</body>
</html>